<!DOCTYPE html>
<html lang="en">
<head>
	   {{template "pc/public/mycss.html" .}}
</head>
<style type="text/css">
	#wrapper{
		background: #f5f5f5!important;
	}
	.header-center{
		background: #fff;
	}
	.user_left{
		background: #fff;
	}
	.fenlei{
		width: 20%;
	}
	
	@media (max-width: 992px){
		.fenlei{
		    width: 100%;
		}
	}
    .driver{width: 100%;}
    .driver dt{width: 50px;float: left;}
    .driver dd{width: 50px;line-height: 50px;float: left;width: calc(100% - 50px);text-align: left;padding-left: 10px;}
    .driver dt img{width: 50px;height: 50px;border-radius: 50%;}

</style>
<body class="common-home res layout-home1">
<div id="wrapper" class="wrapper-full banners-effect-7">
	<!-- Header Container  -->
	{{template "pc/public/head.html" .}}
  {{template "pc/public/mytop.html" .}}
	<div class="main-container container">
		<div class="row mb-50">
			<!--Left Part Start -->
			{{template "pc/public/myleft.html" .}}
			<!--Middle Part Start-->
			<div id="content" class="col-md-10 col-sm-8 right mt-15">
				<div class="allorder">
					<div class="my_order">
            <div class="order_list">
                <div class="rental_order neworder">
                    <table class="table">
                        <thead class="cart_head">
                            <tr class="theader">
                                <th class="tx-l" width="40%">订单商品</th>
                                <th width="10%">状态</th>
                                <th width="10%">数量</th>
                                <th width="15%">体积&重量</th>
                                <th width="15%">取货司机</th>
                                <th width="10%">操作</th>
                            </tr>
                        </thead>
                        <script type="text/javascript">
                            console.log({{.info}})
                        </script>
                        {{if .info}}
                        {{range $q,$i:=.info}}
                        <tbody>
                            <tr>
                                <td class="row-sep" colspan="6"></td>
                            </tr>
                            <tr class="order_time">
                                <td colspan="6"><span>{{$i.addtime}}</span>订单号：{{$i.ordernum}}</td>
                            </tr>
                            {{range $k,$v:=.shopcar}}
                            <tr class="order_detail">
                                <td class="order_pic" colspan="1">
                                    <span><a href="/product/content?id={{$v.pid}}"><img src="{{$v.path}}"></a></span>
                                    <div class="cpintroduction">
                                        <p><a href="/product/content?id={{$v.pid}}">{{$v.title}}</a></p>
                                        <p>
                                            规格∶{{$v.number}}{{$v.spec}}/箱<br>
                                            型号∶{{$v.model}}
                                        </p>
                                    </div>
                                </td>
                                <td class="pri" colspan="1">
                                    <span>
                                        {{if eq $v.status "2"}}
                                        待备货
                                        {{else if eq $v.status "3"}}
                                            {{if eq $v.num $v.sendnum}}
                                            已备货
                                            {{else}}
                                            已备货
                                            {{$v.sendnum}}
                                            {{end}}
                                        {{else if eq $v.status "4"}}
                                        已取货
                                        {{else}}
                                        订单结束
                                        {{end}}
                                        <!-- 微信支付 -->
                                    </span>
                                </td>
                                <td colspan="1">{{$v.num}}</td>
                                {{if eq $k 0}}

                                <td class="operation"  colspan="1" rowspan="{{($i.shopcar|len)}}">
                                    <div class="tip">
                                        <dl>
                                            {{if ne $i.volume "0.00"}}
                                            <dd>货物体积<span>{{$i.volume}}立方</span></dd>
                                            {{end}}
                                            {{if ne $i.we "0.00"}}
                                            <dd>货物重量<span>{{$i.we}}千克</span></dd>
                                            {{end}}
                                        </dl>
                                    </div>
                                </td> 
                                <td class="operation"  colspan="1" rowspan="{{($i.shopcar|len)}}">
                                    {{if .pathname}}
                                    <dl class="driver">
                                        <dt><img src="{{.pathname}}"></dt>
                                        <dd>{{.monicker}}</dd>
                                    </dl>
                                    {{end}}
                                </td>
                                <td class="operation"  colspan="1" rowspan="{{($i.shopcar|len)}}">
                                    {{if eq .status "2"}}
                                    <a style="color: #e31939" class="ok" data-id="{{$v.id}}" data-oid="{{$i.id}}">确认备货</a><br>
                                    <a style="color: #e31939" class="lost" data-id="{{$v.id}}" data-oid="{{$i.id}}" data-num="{{$v.num}}">缺货</a>
                                    {{end}}
                                </td>
                                {{else}}
                                {{end}}
                            </tr>
                            {{end}}
                        </tbody>
                        {{end}}
                        <!-- <tbody>
                            <tr>
                                <td class="row-sep" colspan="5"></td>
                            </tr>
                            <tr class="order_time">
                                <td colspan="5"><span>2014-20-10 19:05:50</span>订单号：1321654651321</td>
                            </tr>
                            <tr class="order_detail">
                                <td class="order_pic" >
                                    <span><img src="../../img/pc/imgs/bbb.jpg"></span>
                                    <span><img src="../../img/pc/imgs/bbb.jpg"></span>
                                    <span><img src="../../img/pc/imgs/bbb.jpg"></span>
                                    <div class="cpintroduction">
                                        <p class="overpl1">共1件</p>
                                        <p class="overpl2">
                                            <a href="orderdetails.html">查看订单</a>
                                        </p>
                                    </div>
                                </td>
                                <td class="pri">
                                    <span>
                                        ￥64.00<br>
                                    </span>
                                </td>
                                <td>1</td>
                                <td class="c-e30b17">
                                    ( 待付款 )
                                </td>
                                <td class="operation">
                                    <a class="c-999 mt-5 db-i" href="orderdetails.html">去付款</a>
                                </td>
                            </tr>
                        </tbody> -->
                        </tbody>
                        {{end}}
                    </table>
                  <script type="text/javascript">
                    console.log({{.paginator}})
                  </script>
                    {{if .paginator}}
                    {{if ne .paginator.totalpages 1}}
                    <div class="page" style="text-align: center;">
                        {{if ne .paginator.currpage 1}}
                        <span class="prev new_prev">
                            <a href="{{$.url}}page={{.paginator.prevpage}}"><i class="iconfont icon-zuocefanhui"></i></a>
                        </span>
                        <span class="pd_page"><a href="{{$.url}}page=1">首页</a></span>
                        {{else}}
                        <span class="prev new_prev">
                            <i class="iconfont icon-zuocefanhui"></i>
                        </span>
                        <span class="pd_page">首页</span>
                        {{end}}
                        {{range $index,$page := .paginator.pages}}
                        {{if eq $.paginator.currpage $page}} 
                        <span class="on">{{$page}}</span>
                        {{else}}
                        <a class="num" href="{{$.url}}page={{$page}}"><span class="">{{$page}}</span></a>
                        {{end}}
                        {{end}}
                        {{if eq .paginator.currpage .paginator.totalpages}}
                        <span class="pd_page">末页</span>
                        <span class="new_next">
                        <i class="iconfont icon-youcexuanzejiantou"></i>
                        </span>
                        {{else}}
                        <a class="num" href="{{$.url}}page={{.paginator.totalpages}}"><span class="pd_page">末页</span></a>
                        <a class="next" href="{{$.url}}page={{.paginator.nextpage}}">
                            <span class="new_next">
                            <i class="iconfont icon-youcexuanzejiantou"></i>
                            </span>
                        </a>
                        {{end}}
                    </div>
                    {{end}}
                    {{end}}
                </div>
            </div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

{{template "pc/public/foot.html" .}}
{{template "pc/public/myfoot.html" .}}
</body>
</html>
<script type="text/javascript">
$('.ok').click(function(){
    var id=$(this).attr('data-id')
    var oid=$(this).attr('data-oid')
    var that=$(this)
    // console.log(that.parent().parent().parent().find('dl a>span').html('已备货'))

    wxc.xcConfirm("您确定已经完成备货了吗?","confirm",{onOk:function(){
        $.ajax({
                type: 'post',
                url: window.location.href,
                data:{id:id,oid:oid},
                success:function(res){
                    if(res==1){
                        showToast("完成备货成功~")
                        history.go(0)
                    }else {
                        showToast("网络繁忙,请重试~");
                    }
                }
            })
        }});
})
$('.lost').click(function(){
    var id=$(this).attr('data-id')
    var oid=$(this).attr('data-oid')
    var carnum=$(this).attr('data-num')
    var that=$(this)
    wxc.xcConfirm("请输入您缺少的数量!","input",{onOk:function(res){
        var num=res
        if(num>0&&num<=carnum){     
             $.ajax({
                type: 'post',
                url: window.location.href,
                data:{id:id,num:num,oid:oid},
                success:function(res){
                    if(res==1){
                       showToast("完成备货成功~")
                        history.go(0)
                    }else {
                        showToast("网络繁忙,请重试~");
                    }
                }
            })
        }else{
            showToast("请输入正确的数量");
        }
    }});
    // mui.prompt("请输入您缺少的数量!","提示",function(data){
    //     if(data.index){
    //         var oid=that.parent().parent().parent().parent().parent().attr('data-id')
    //         $.ajax({
    //             type: 'post',
    //             url: window.location.href,
    //             data:{id:id,num:data.value,oid:oid},
    //             success:function(res){
    //                 if(res==1){
    //                    showToast("完成备货成功~")
    //                     history.go(0)
    //                 }else {
    //                     showToast("网络繁忙,请重试~");
    //                 }
    //             }
    //         })
    //     }
    // })
})
</script>
